"""
    请求路由定义及相关的业务处理
    Handler相当于Web中的Controller
    ViewRouterInterface定义了获取路由配置的统一接口
        即configRouter方法返回路由配置数组
"""
from views.LoginHandler import LoginHandler
from views.TestHandler import TestHandler
from views.MainHandler import MainHandler
from views.IndexHandler import IndexHandler
from views.JavaHandler import JavaHandler
from views.PythonHandler import PythonHandler

# from views.index.index import IndexHandler, LoginHandler
# from views.upload.UploadUtilsHandlerKit import UploadFileHandler
print("******start to import view Request Handler packages******")

# 定义所有的RequestHandler
ALL_HANDLERS = [
    TestHandler, MainHandler, IndexHandler, JavaHandler, PythonHandler, LoginHandler
    # IndexHandler, LoginHandler, UploadFileHandler
]

"""
    获取所有的路由
"""


def all_router_configs():
    allRouters = []
    for viewRouterInterface in ALL_HANDLERS:
        routerConfigs = viewRouterInterface.configRouter(viewRouterInterface)
        if routerConfigs is None:
            continue
        allRouters.extend(routerConfigs)
    print("ALL ROUTER CONFIGS[公共路由表]：", allRouters)
    return allRouters
